/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ar.edu.unicen.twitter.suggest.frontend.charts.graph;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 * @author Alex
 */
public class Graph {
    private List<Node> nodes = new ArrayList<Node>();
    private Map<Long, ArrayList<Long>> links = new HashMap<Long, ArrayList<Long>>();

    public long addNode(Node node) {
        getNodes().add(node);
        return getNodes().size()-1;
    }

    public void addLink(long origen, long destino) {
        ArrayList<Long> linksOrigen = getLinks().get(origen);
        if(linksOrigen == null)
        {
            linksOrigen = new ArrayList<Long>();
            getLinks().put(origen, linksOrigen);
        }
        linksOrigen.add(destino);
    }

    public List<Node> getNodes() {
        return nodes;
    }

    public Map<Long, ArrayList<Long>> getLinks() {
        return links;
    }
    
}
